home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / forms / demotod / demotod.frm < prev    next >
Text File  |  1995-06-09  |  6KB  |  230 lines

  1. VERSION 2.00
  2. Begin Form DemoTOD 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Tip of the Day"
  6.    ClientHeight    =   2940
  7.    ClientLeft      =   1905
  8.    ClientTop       =   2505
  9.    ClientWidth     =   5625
  10.    ControlBox      =   0   'False
  11.    Height          =   3345
  12.    Left            =   1845
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2940
  17.    ScaleWidth      =   5625
  18.    Top             =   2160
  19.    Width           =   5745
  20.    Begin SSFrame Frame3D1 
  21.       Font3D          =   0  'None
  22.       Height          =   2445
  23.       Left            =   105
  24.       TabIndex        =   4
  25.       Top             =   30
  26.       Width           =   4125
  27.       Begin TextBox Text_TOD 
  28.          BorderStyle     =   0  'None
  29.          FontBold        =   0   'False
  30.          FontItalic      =   0   'False
  31.          FontName        =   "MS Sans Serif"
  32.          FontSize        =   8.25
  33.          FontStrikethru  =   0   'False
  34.          FontUnderline   =   0   'False
  35.          Height          =   1365
  36.          Left            =   240
  37.          MultiLine       =   -1  'True
  38.          TabIndex        =   5
  39.          Text            =   "Tip of the Day Tip...."
  40.          Top             =   960
  41.          Width           =   3615
  42.       End
  43.       Begin Line Line2 
  44.          Index           =   1
  45.          X1              =   3990
  46.          X2              =   3990
  47.          Y1              =   210
  48.          Y2              =   2340
  49.       End
  50.       Begin Line Line2 
  51.          Index           =   0
  52.          X1              =   100
  53.          X2              =   100
  54.          Y1              =   210
  55.          Y2              =   2340
  56.       End
  57.       Begin Line Line1 
  58.          Index           =   1
  59.          X1              =   110
  60.          X2              =   4010
  61.          Y1              =   2330
  62.          Y2              =   2330
  63.       End
  64.       Begin Line Line1 
  65.          Index           =   0
  66.          X1              =   110
  67.          X2              =   4010
  68.          Y1              =   190
  69.          Y2              =   190
  70.       End
  71.       Begin Shape Shape2 
  72.          BackColor       =   &H00FFFFFF&
  73.          BackStyle       =   1  'Opaque
  74.          BorderColor     =   &H00FFFFFF&
  75.          Height          =   1365
  76.          Left            =   120
  77.          Top             =   960
  78.          Width           =   3885
  79.       End
  80.       Begin Label Label1 
  81.          Caption         =   "Did you know..."
  82.          Height          =   225
  83.          Left            =   720
  84.          TabIndex        =   6
  85.          Top             =   570
  86.          Width           =   1395
  87.       End
  88.       Begin Image Image1 
  89.          Height          =   570
  90.          Left            =   210
  91.          Picture         =   DEMOTOD.FRX:0000
  92.          Top             =   300
  93.          Width           =   420
  94.       End
  95.       Begin Shape Shape1 
  96.          BackStyle       =   1  'Opaque
  97.          BorderColor     =   &H00FFFFFF&
  98.          Height          =   765
  99.          Left            =   120
  100.          Top             =   210
  101.          Width           =   3885
  102.       End
  103.    End
  104.    Begin SSCheck Check3D_TOD 
  105.       Caption         =   "Show Tips at Startup"
  106.       Font3D          =   0  'None
  107.       Height          =   255
  108.       Left            =   105
  109.       TabIndex        =   3
  110.       Top             =   2580
  111.       Value           =   -1  'True
  112.       Width           =   2085
  113.    End
  114.    Begin CommandButton Command_TOD 
  115.       Caption         =   "&Help"
  116.       Height          =   315
  117.       Index           =   2
  118.       Left            =   4350
  119.       TabIndex        =   2
  120.       Top             =   990
  121.       Width           =   1170
  122.    End
  123.    Begin CommandButton Command_TOD 
  124.       Caption         =   "&Next"
  125.       Height          =   315
  126.       Index           =   1
  127.       Left            =   4350
  128.       TabIndex        =   1
  129.       Top             =   540
  130.       Width           =   1170
  131.    End
  132.    Begin CommandButton Command_TOD 
  133.       Caption         =   "OK"
  134.       Height          =   315
  135.       Index           =   0
  136.       Left            =   4365
  137.       TabIndex        =   0
  138.       Top             =   105
  139.       Width           =   1170
  140.    End
  141. End
  142. Option Explicit
  143.  
  144. Dim FileNum
  145. Dim TipPos&
  146. Dim TipLen%
  147. Dim Tip$
  148.  
  149. Sub Command_TOD_Click (Index As Integer)
  150.  
  151.     Select Case Index
  152.         Case 0
  153.             DemoApp.VBini.Section = "TOD"
  154.             DemoApp.VBini.Entry = "TipPos"
  155.             DemoApp.VBini.String = Str(TipPos&)
  156.             DemoApp.VBini.Refresh
  157.  
  158.             DemoApp.VBini.Entry = "TipStart"
  159.             DemoApp.VBini.String = IIf(Check3D_TOD = True, " ", "No")
  160.             DemoApp.VBini.Refresh
  161.  
  162.             Unload Me
  163.             Set DemoTOD = Nothing
  164.         Case 1
  165.             GetNextTip
  166.         Case 2
  167. '            dummy% = WinHelp(Me.hWnd, App.HelpFile, HELP_CONTEXT, HlpCntxtID&)
  168.      End Select
  169.  
  170. End Sub
  171.  
  172. Sub Form_Activate ()
  173.  
  174.     If Me.Width = 1 Then
  175.         Unload Me
  176.         Set DemoTOD = Nothing
  177.     End If
  178.  
  179. End Sub
  180.  
  181. Sub Form_Load ()
  182.  
  183. '    HlpCntxtID& = Tip_of_the_Day
  184.     
  185.     Me.Move (Screen.Width - Me.Width) / 2, ((Screen.Height - Me.Height) / 2) + 200
  186.  
  187.     DemoApp.VBini.FileName = App.Path + "\DemoApp.INI"
  188.     DemoApp.VBini.Section = "TOD"
  189.     DemoApp.VBini.Entry = "TipPos"
  190.     DemoApp.VBini.String = ""
  191.     DemoApp.VBini.Refresh
  192.  
  193.     TipPos& = IIf(DemoApp.VBini.String = "", 1, Val(DemoApp.VBini.String))
  194.  
  195.     On Error GoTo SeeYa
  196.     
  197.     FileNum = FreeFile
  198.  
  199.     Open App.Path & "\TOD.TIP" For Binary As FileNum
  200.  
  201.     GetNextTip
  202.  
  203.     Exit Sub
  204.  
  205. SeeYa:
  206.  
  207.     Me.Width = 1
  208.     Me.Height = 1
  209.  
  210. End Sub
  211.  
  212. Sub GetNextTip ()
  213.  
  214.     If TipPos& >= LOF(FileNum) Then
  215.         TipPos& = 1
  216.     End If
  217.     
  218.     Get FileNum, TipPos&, TipLen%
  219.     
  220.     Text_TOD = Input$(TipLen%, FileNum)
  221.  
  222.     TipPos& = Seek(FileNum)
  223.             
  224.     If TipPos& >= LOF(FileNum) Then
  225.         TipPos& = 1
  226.     End If
  227.  
  228. End Sub
  229.  
  230.